<script>
export default {
  name: 'FilterPage',
  emits: ['select'],
  props: {
    statusList: {
      type: Array,
      required: true
    }
  },
  data() {
    return {
      currentActive: undefined
    }
  },
  methods: {
    changeCurrentActive(item) {
      this.currentActive = item.type
      this.$emit('select', item.type)
    }
  }
}
</script>

<template>
  <el-card shadow="never" class="filter">
    <ul>
      <li v-for="(item,index) in statusList" :key="index" :class="item.type===currentActive?'active':''" @click="changeCurrentActive(item)">{{ item.label }}</li>
    </ul>
  </el-card>
</template>

<style scoped lang="scss">
::v-deep .el-card__body {
  padding: 0 !important;
  height: 50px;
}

ul {
  display: flex;

  li {
    height: 100%;
    line-height: 50px;
    text-align: center;
    width: 120px;
    font-size: 15px;
    font-weight: 520;
    color: #333333;
    cursor: pointer;

    &:hover {
      color: #e15536;
    }

    &.active {
      background-color: #ffeeeb;
      color: #e15536;
    }
  }
}
</style>
